package com.yxhl.zoume.domain.interactor.indetification;

import com.yxhl.zoume.data.http.repository.identification.IdentificationRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.identification.IdentificationParam;
import com.yxhl.zoume.data.http.rest.response.identification.IdentificationResponse;
import com.yxhl.zoume.domain.DomainConstants;
import com.yxhl.zoume.domain.interactor.base.UseCase;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * 项目名称：Ferrari
 * Created by menggod on 16/9/20 .
 */

public class IdentificationQueryUseCase extends UseCase<IdentificationResponse> {

    private IdentificationRepository mIdentificationRepository;

    @Inject
    public IdentificationQueryUseCase(@Named(DomainConstants.UI_THREAD) Scheduler uiThread,
                                      @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
                                      IdentificationRepository identificationRepository) {
        super(uiThread, executorThread);
        mIdentificationRepository = identificationRepository;
    }

    @Override
    protected Observable<IdentificationResponse> buildObservable(RequestParamImpl param) {
        return mIdentificationRepository
                .queryIdentificationStatus((IdentificationParam) param)
                .subscribeOn(executorThread)
                .observeOn(uiThread);
    }
}
